package com.evil.common.rocketmq.interseptor;

import com.evil.common.rocketmq.annotation.SystemLogin;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.AfterReturning;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;

/**
 * 系统自动化
 *
 * @author liyang
 * @date 2021/11/11 10:41
 */
@Slf4j
@Aspect
@Component
@RequiredArgsConstructor
public class SystemLoginAspect {

    @Pointcut("execution(public * * (..) ) && @annotation(systemLogin)")
    public void systemLoginPointCut(SystemLogin systemLogin) {
    }

    @Before(value = "systemLoginPointCut(systemLogin)", argNames = "joinPoint,systemLogin")
    public void access(JoinPoint joinPoint, SystemLogin systemLogin) {
    }

    @Before(value = "systemLoginPointCut(systemLogin)", argNames = "joinPoint,systemLogin")
    public void before(JoinPoint joinPoint, SystemLogin systemLogin) {
    }

    @AfterReturning(value = "systemLoginPointCut(systemLogin)", argNames = "joinPoint,systemLogin")
    public void doAfterReturning(JoinPoint joinPoint, SystemLogin systemLogin) {
    }
}
